/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.game.wordpuzzle;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author AritomoAbe
 */
public class JoinGameAction implements GameAction {

    @Override
    public void processActionRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String userName = request.getParameter("userName");
        String gameId = request.getParameter("gameId");

        GameManager gameManager = GameManager.getGameManager();
        Game game = gameManager.getActiveGame(gameId);
        if (game != null) {
            game.joinGame(userName);
        }
    }

}
